<?xml version="1.0" encoding="ISO-8859-1" ?>

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:rich="http://richfaces.org/rich"
	  xmlns:a4j="http://richfaces.org/a4j">

	<f:subview id="subviewPopupVenda">
		<rich:modalPanel id="popupVenda" width="750" height="470" headerClass="height:20px;" resizeable="false" >
			<f:facet name="header">
				<h:outputText value="#{bundle.venda_titulo_consultar}" />
			</f:facet>
			<f:facet name="controls">
				<h:panelGroup>
					<h:graphicImage value="/images/close.gif" styleClass="botao_fechar_popup" id="hideLink">
						<rich:componentControl for="popupVenda" attachTo="hideLink" operation="hide" event="onclick" />
					</h:graphicImage>
				</h:panelGroup>
			</f:facet>
			<a4j:form ajaxSubmit="true" id="formVendaConsulta">
				
				<center>
					<rich:extendedDataTable id="gridVenda" value="#{vendaBackBean.vendaFormBean.listaVenda}" var="venda" height="371px" sortMode="single" rows="10" selectionMode="none" lang="pt">
						<rich:column id="tabela_venda_selecionar" label="#{bundle.venda_btn_selecionar}">
							<f:facet name="header">
								<h:outputText value="#{bundle.venda_btn_selecionar}"/>
							</f:facet>
							<center>
								<a4j:commandLink id="btnSelecionar" reRender="formVendaConsulta"
												 onclick="preencheDadosPopupVenda('#{venda.codigo}', '#{venda.descricao}');">
									<h:graphicImage width="24" value="/images/select.png" style="border:none;" >
										<rich:componentControl for="popupVenda" attachTo="btnSelecionar" operation="hide" event="onclick" />
									</h:graphicImage>
								</a4j:commandLink>
							</center>
						</rich:column>
						<rich:column id="tabela_venda_codigo" width="100" label="#{bundle.venda_codigo}" sortable="true" sortBy="#{venda.codigo}">
							<f:facet name="header">
								<h:outputText value="#{bundle.venda_codigo}" />
							</f:facet>
							<center>
								<h:outputText value="#{venda.codigo}" />
							</center>
						</rich:column>
						<rich:column id="tabela_venda_descricao" width="200" label="#{bundle.venda_descricao}" sortable="true" sortBy="#{venda.descricao}">
							<f:facet name="header">
								<h:outputText value="#{bundle.venda_descricao}"/>
							</f:facet>
							<h:outputText value="#{venda.descricao}"/>
						</rich:column>
					</rich:extendedDataTable>
					<rich:datascroller id="dsGridVenda" for="gridVenda" renderIfSinglePage="true" maxPages="10"/>
				</center>
				
				<div class="linha"/>
				
				<a4j:commandButton action="#{vendaBackBean.obterListaVenda}" value="#{bundle.venda_btn_consultar}" reRender="formVendaConsulta" />
				<a4j:commandButton value="#{bundle.venda_btn_novo}" actionListener="#{vendaBackBean.listenerIrInserirVenda}" id="btnNovo" reRender="formVendaManter">
					<rich:componentControl for="manterVenda" attachTo="btnNovo" operation="show" event="onclick" />
				</a4j:commandButton>
				<a4j:commandButton value="#{bundle.venda_btn_voltar}" id="btnVoltar" reRender="formVendaConsulta" >
                	<rich:componentControl for="popupVenda" attachTo="btnVoltar" operation="hide" event="onclick" />
                </a4j:commandButton>
				
			</a4j:form>

		</rich:modalPanel>
	</f:subview>
	
	<ui:include src="/pages/venda/manterVenda.xhtml" />
	
</html>